home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / TommyVideo.iso / flash / menu.swf / scripts / %3Cdefault package%3E / HFHierMenuSymbol.as next >
Encoding:
Text File  |  2003-06-08  |  42.5 KB  |  1,196 lines

  1. _global.setTimeout = function(a, b, c, args)
  2. {
  3.    if(typeof arguments[0] == "function")
  4.    {
  5.       args = arguments.slice(2);
  6.       var ID;
  7.       var func = function()
  8.       {
  9.          a.apply(null,args);
  10.          clearInterval(ID);
  11.       };
  12.       ID = setInterval(func,b,args);
  13.    }
  14.    else
  15.    {
  16.       args = arguments.slice(3);
  17.       var ID;
  18.       var func = function()
  19.       {
  20.          a[b].apply(a,args);
  21.          clearInterval(ID);
  22.       };
  23.       ID = setInterval(func,c,args);
  24.    }
  25.    return ID;
  26. };
  27. _global.clearTimeout = clearInterval;
  28. MovieClip.prototype.drawrectangle = function(x, y, w, h)
  29. {
  30.    this.moveTo(x,y);
  31.    this.lineTo(x + w,y);
  32.    this.lineTo(x + w,y + h);
  33.    this.lineTo(x,y + h);
  34.    this.lineTo(x,y);
  35. };
  36. Math.linearTween = function(t, b, c, d)
  37. {
  38.    return c * t / d + b;
  39. };
  40. HFHierMenuClass = function()
  41. {
  42.    this.init();
  43. };
  44. HFHierMenuClass.prototype = new MovieClip();
  45. HFHierMenuClass.prototype.init = function()
  46. {
  47.    if(_root.itemToCreate == 13)
  48.    {
  49.       _root.itemToCreate = 0;
  50.       _root.itemX = 0;
  51.       _root.itemXNew = 0;
  52.    }
  53.    this.family = new Array();
  54.    this.highlightedItems = new Array();
  55.    this.radioGroups = new Array();
  56.    if(this.applySound)
  57.    {
  58.       this.rollOverSndObj = new Sound();
  59.       this.rollOverSndObj.attachSound(this.rollOverSnd);
  60.       this.pressSndObj = new Sound();
  61.       this.pressSndObj.attachSound(this.pressSnd);
  62.    }
  63.    this.getXMLContent();
  64.    if(this.menuSlide)
  65.    {
  66.       this.createEmptyMovieClip("$tmpMaskMC",-200);
  67.    }
  68.    this.padding = 5;
  69.    this.depth = -1;
  70.    this.isOnSub = false;
  71.    this.parentPressedLabel = "";
  72.    this.pressedLabel = "";
  73.    this.pressedIdx = null;
  74.    this.isOnClick = false;
  75.    this.currentIdx = 0;
  76.    if(this.xmlFileName == "disclaimer")
  77.    {
  78.       if(_level1._root.translating)
  79.       {
  80.          _level1._root.translatorController.play();
  81.       }
  82.       else if(_level1._root.skip)
  83.       {
  84.          _level1._root.menuHider.topMenuHider.gotoAndStop(10);
  85.       }
  86.       else
  87.       {
  88.          _level1._root.menuHider.topMenuHider.gotoAndPlay("showMenu");
  89.       }
  90.    }
  91. };
  92. HFHierMenuClass.prototype.getXMLContent = function()
  93. {
  94.    this.xmlObj = new XML();
  95.    this.xmlName = this.xmlFileName + "_" + _level1._root.lang + ".xml";
  96.    if(_level1._root.test or _level1._root.test == undefined)
  97.    {
  98.       this.xmlObj.load(this.xmlName);
  99.    }
  100.    else
  101.    {
  102.       temp = "flash/" + this.xmlName;
  103.       this.xmlObj.load(temp);
  104.    }
  105.    this.xmlObj.parent = this;
  106.    this.xmlObj.onLoad = this.handle_xml_load;
  107. };
  108. HFHierMenuClass.prototype.handleItemNode = function(node, m)
  109. {
  110.    var isCheckBox;
  111.    var checkBoxIsActive;
  112.    if(node.attributes.checkbox == "true")
  113.    {
  114.       isCheckBox = true;
  115.    }
  116.    else
  117.    {
  118.       isCheckBox = false;
  119.    }
  120.    if(node.attributes.active == "true")
  121.    {
  122.       checkBoxIsActive = true;
  123.    }
  124.    else
  125.    {
  126.       checkBoxIsActive = false;
  127.    }
  128.    if(node.attributes.disabled == "true")
  129.    {
  130.       disabled = true;
  131.    }
  132.    else
  133.    {
  134.       disabled = false;
  135.    }
  136.    var itemArray = [node.attributes.name,m != 1 ? Number(node.hasChildNodes()) : Number(node.attributes.sub),node.attributes.action,node.attributes.alterCaption,isCheckBox,checkBoxIsActive,disabled];
  137.    return itemArray;
  138. };
  139. HFHierMenuClass.prototype.handleXMLNodeSubs = function(node, n, ch)
  140. {
  141.    if(node.nodeName == "item")
  142.    {
  143.       var itemArray = this.handleItemNode(node,2);
  144.       if(ch == "")
  145.       {
  146.          this.dp.push(itemArray);
  147.       }
  148.       else
  149.       {
  150.          this["dp_" + ch].push(itemArray);
  151.       }
  152.    }
  153.    else if(node.nodeName == "title")
  154.    {
  155.       if(ch == "")
  156.       {
  157.          this.dp[0] = node.attributes.name;
  158.       }
  159.       else
  160.       {
  161.          this["dp_" + ch][0] = node.attributes.name;
  162.       }
  163.    }
  164.    else if(node.nodeName == "sep")
  165.    {
  166.       if(ch == "")
  167.       {
  168.          this.dp.push("sep");
  169.       }
  170.       else
  171.       {
  172.          this["dp_" + ch].push("sep");
  173.       }
  174.    }
  175.    else if(node.nodeName == "radiogroup")
  176.    {
  177.       var RG_childNodes = node.childNodes;
  178.       var u = 0;
  179.       while(u < RG_childNodes.length)
  180.       {
  181.          if(RG_childNodes[u].nodeName == "item")
  182.          {
  183.             var tempItemArray = this.handleItemNode(RG_childNodes[u],1);
  184.             if(ch == "")
  185.             {
  186.                this.dp.push(tempItemArray);
  187.             }
  188.             else
  189.             {
  190.                this["dp_" + ch].push(tempItemArray);
  191.             }
  192.          }
  193.          if(RG_childNodes[u].nodeName == "sep")
  194.          {
  195.             if(ch == "")
  196.             {
  197.                this.dp.push("sep");
  198.             }
  199.             else
  200.             {
  201.                this["dp_" + ch].push("sep");
  202.             }
  203.          }
  204.          if(RG_childNodes[u].nodeName != "item")
  205.          {
  206.             RG_childNodes.splice(u,1);
  207.             u--;
  208.          }
  209.          u++;
  210.       }
  211.       var radioItemObj = new Object();
  212.       radioItemObj.groupName = node.attributes.name;
  213.       radioItemObj.dp_name = ch != "" ? "dp_" + ch : "dp";
  214.       radioItemObj.start_idx = n;
  215.       radioItemObj.end_idx = radioItemObj.start_idx + RG_childNodes.length;
  216.       radioItemObj.active = node.attributes.active;
  217.       this.radioGroups.push(radioItemObj);
  218.    }
  219.    if(node.hasChildNodes())
  220.    {
  221.       var cn = node.childNodes;
  222.       var counter = cn.length;
  223.       var count = 0;
  224.       var old_chain = new String(ch);
  225.       var idString = new String(n);
  226.       var new_chain;
  227.       if(old_chain == "")
  228.       {
  229.          new_chain = idString;
  230.       }
  231.       else
  232.       {
  233.          new_chain = old_chain + "_" + idString;
  234.       }
  235.       this["dp_" + new_chain] = [];
  236.       this["dp_" + new_chain][0] = "";
  237.       var i = 0;
  238.       while(i < counter)
  239.       {
  240.          if(cn[i].nodeName == "item" || cn[i].nodeName == "title" || cn[i].nodeName == "sep" || cn[i].nodeName == "radiogroup")
  241.          {
  242.             this.handleXMLNodeSubs(cn[i],i - count,new_chain);
  243.          }
  244.          if(cn[i].nodeName != "item" && cn[i].nodeName != "checkgroup" && cn[i].nodeName != "null")
  245.          {
  246.             count++;
  247.          }
  248.          i++;
  249.       }
  250.    }
  251. };
  252. HFHierMenuClass.prototype.handle_xml_load = function(success)
  253. {
  254.    if(success)
  255.    {
  256.       if(this.firstChild.nodeName == "hiermenu")
  257.       {
  258.          this.parent.method = this.firstChild.attributes.method;
  259.          if(this.parent.method == "2")
  260.          {
  261.             this.parent.dp = new Array();
  262.             this.parent.dp[0] = "";
  263.             var childs = this.firstChild.childNodes;
  264.             var i = 0;
  265.             while(i < childs.length)
  266.             {
  267.                if(childs[i].nodeName == "item" || childs[i].nodeName == "title" || childs[i].nodeName == "sep")
  268.                {
  269.                   this.parent.handleXMLNodeSubs(childs[i],i - count,"");
  270.                }
  271.                if(childs[i].nodeName != "item" && childs[i].nodeName != "null")
  272.                {
  273.                   count++;
  274.                }
  275.                i++;
  276.             }
  277.          }
  278.          else
  279.          {
  280.             var childs = this.firstChild.childNodes;
  281.             var i = 0;
  282.             while(i < childs.length)
  283.             {
  284.                var name = childs[i].nodeName;
  285.                if(name.substring(0,2) == "dp")
  286.                {
  287.                   var titleExist;
  288.                   this.parent[name] = new Array();
  289.                   subchilds = childs[i].childNodes;
  290.                   if(childs[i].attributes.title == "true")
  291.                   {
  292.                      titleExist = true;
  293.                   }
  294.                   else
  295.                   {
  296.                      titleExist = false;
  297.                      this.parent[name][0] = "";
  298.                   }
  299.                   var j = 0;
  300.                   while(j < subchilds.length)
  301.                   {
  302.                      if(subchilds[j].nodeName != null)
  303.                      {
  304.                         var itemArray = this.parent.handleItemNode(subchilds[j],1);
  305.                         if(_level1._root.menuName == this.parent.xmlFileName)
  306.                         {
  307.                            if(itemArray[1] == _root.menuId - 1 and itemArray[2] == "no")
  308.                            {
  309.                               _root.menuLabel = itemArray[0];
  310.                               _root.alternativeCaption = "";
  311.                            }
  312.                            else if(itemArray[2] == _root.currentAction)
  313.                            {
  314.                               _root.menuSubLabel = itemArray[0];
  315.                               _root.alternativeCaption = itemArray[3];
  316.                            }
  317.                         }
  318.                         if(this.parent.xmlFileName == "menu" and itemArray[2].slice(0,7) == "volumes")
  319.                         {
  320.                            counter = Math.round(j / 2);
  321.                            _root.volumeAlternative[counter] = itemArray[3];
  322.                         }
  323.                         if(this.parent.xmlFileName == "menu" and itemArray[2] == "support/product_specification")
  324.                         {
  325.                            _root.idSpecifications = Math.round(j / 2);
  326.                            _root.captionSpecifications = itemArray[0];
  327.                            _root.alternativeSpecifications = itemArray[3];
  328.                         }
  329.                         if(this.parent.xmlFileName == "menu" and itemArray[1] == "2")
  330.                         {
  331.                            _root.parSpecifications = itemArray[0];
  332.                         }
  333.                         if(subchilds[j].nodeName == "radiogroup")
  334.                         {
  335.                            var RG_childNodes = subchilds[j].childNodes;
  336.                            var u = 0;
  337.                            while(u < RG_childNodes.length)
  338.                            {
  339.                               if(RG_childNodes[u].nodeName == "item")
  340.                               {
  341.                                  var tempItemArray = this.parent.handleItemNode(RG_childNodes[u],1);
  342.                                  this.parent[name].push(tempItemArray);
  343.                               }
  344.                               if(RG_childNodes[u].nodeName == "sep")
  345.                               {
  346.                                  this.parent[name].push("sep");
  347.                               }
  348.                               if(RG_childNodes[u].nodeName != "item")
  349.                               {
  350.                                  RG_childNodes.splice(u,1);
  351.                                  u--;
  352.                               }
  353.                               u++;
  354.                            }
  355.                            var radioItemObj = new Object();
  356.                            radioItemObj.groupName = subchilds[j].attributes.name;
  357.                            radioItemObj.dp_name = name;
  358.                            radioItemObj.start_idx = parseInt(j) - 1;
  359.                            radioItemObj.end_idx = radioItemObj.start_idx + RG_childNodes.length - 1;
  360.                            radioItemObj.active = subchilds[j].attributes.active;
  361.                            this.parent.radioGroups.push(radioItemObj);
  362.                         }
  363.                         if(titleExist)
  364.                         {
  365.                            if(subchilds[j].nodeName == "title")
  366.                            {
  367.                               this.parent[name][0] = subchilds[j].attributes.name;
  368.                            }
  369.                            else if(subchilds[j].nodeName == "item")
  370.                            {
  371.                               this.parent[name].push(itemArray);
  372.                            }
  373.                            else if(subchilds[j].nodeName == "sep")
  374.                            {
  375.                               this.parent[name].push("sep");
  376.                            }
  377.                         }
  378.                         else
  379.                         {
  380.                            if(subchilds[j].nodeName == "item")
  381.                            {
  382.                               this.parent[name].push(itemArray);
  383.                            }
  384.                            if(subchilds[j].nodeName == "sep")
  385.                            {
  386.                               this.parent[name].push("sep");
  387.                            }
  388.                         }
  389.                      }
  390.                      j++;
  391.                   }
  392.                }
  393.                i++;
  394.             }
  395.          }
  396.       }
  397.       this.parent.createMenu(0,0,0,this.parent.dp,"dp");
  398.    }
  399.    else
  400.    {
  401.       trace(" > ERROR: The file " + this.xmlFileName + " has not been found");
  402.    }
  403. };
  404. HFHierMenuClass.prototype.createMenu = function(x, y, hier, dp, dp_name, ox, oy)
  405. {
  406.    this.depth = this.depth + 1;
  407.    this.numSep = 0;
  408.    var menu = this.createEmptyMovieClip("menu_" + this.depth,this.depth);
  409.    menu._alpha = Number(!this.menuFade) * 100;
  410.    menu.treePos = hier;
  411.    menu.depth = this.depth;
  412.    if(this.menuSlide)
  413.    {
  414.       if(this.menuType == "Vertical" || hier > 0)
  415.       {
  416.          menu._x = ox;
  417.          menu._y = y;
  418.       }
  419.       else if(this.menuType == "Horizontal" && hier == 0)
  420.       {
  421.          menu._x = x;
  422.          menu._y = oy;
  423.       }
  424.    }
  425.    else
  426.    {
  427.       menu._x = x;
  428.       menu._y = y;
  429.    }
  430.    var parent_array = "dp";
  431.    var z = 0;
  432.    while(z < this.family.length - 1)
  433.    {
  434.       parent_array += "_" + this.family[z];
  435.       z++;
  436.    }
  437.    var array_ref = this[parent_array];
  438.    var pID = this.family[hier - 1] + 1 + this.getNumSeps(array_ref,this.family[hier - 1]);
  439.    if(dp_name == parent_array)
  440.    {
  441.       menu.parentLabel = "";
  442.    }
  443.    else
  444.    {
  445.       menu.parentLabel = array_ref[pID][0];
  446.    }
  447.    menu.parentItemRef = this["menu_" + (this.depth - 1)]["PItem_" + pID];
  448.    menu.pID = pID;
  449.    if(this.autoSizeWidth)
  450.    {
  451.       this.menuWidth = this.getMenuWidth(dp);
  452.    }
  453.    var titleExist = dp[0] != "";
  454.    var numTitleExist = Number(!titleExist);
  455.    if(this.menuType == "Vertical" || hier > 0)
  456.    {
  457.       if(dp[0] != "")
  458.       {
  459.          this.titleInitObj = new Object();
  460.          this.titleInitObj._x = this.titleInitObj._y = 0;
  461.          this.titleInitObj.parent = this;
  462.          this.titleInitObj.txtColor = this.titleTxtColor;
  463.          this.titleInitObj.txtLabel = dp[0];
  464.          this.titleInitObj.txtAlign = "center";
  465.          this.titleInitObj.menuWidth = this.menuWidth;
  466.          this.titleInitObj.txtIsBold = true;
  467.          this.titleInitObj.bgColor = this.titleBGColor;
  468.          this.titleInitObj.isTitle = true;
  469.          menu.attachMovie("ItemSymbol","MTitle",0,this.titleInitObj);
  470.       }
  471.    }
  472.    var applyRadio = false;
  473.    radioSpecs.splice(0,radioSpecs.length);
  474.    var radioSpecs = new Array();
  475.    var c = 0;
  476.    while(c < this.radioGroups.length)
  477.    {
  478.       if(this.radioGroups[c].dp_name == dp_name)
  479.       {
  480.          applyRadio = true;
  481.          radioSpecs.push(this.radioGroups[c]);
  482.       }
  483.       c++;
  484.    }
  485.    var i = 1;
  486.    while(i < dp.length)
  487.    {
  488.       if(_root.itemToCreate < _root.upperMenuCount + 1)
  489.       {
  490.          this.menuWidth = this.getOneMenuWidth(dp[i][0]);
  491.          _root.itemX += this.menuWidth;
  492.          if(_root.itemToCreate < 1)
  493.          {
  494.             _root.itemXNew = 0;
  495.          }
  496.          if(_root.itemToCreate == _root.upperMenuCount)
  497.          {
  498.             _root.itemX = 0;
  499.          }
  500.       }
  501.       else if(_root.itemToCreate < _root.upperMenuCount + _root.bottomMenuCount + 1)
  502.       {
  503.          this.menuWidth = this.getOneMenuWidth(dp[i][0]);
  504.          _root.itemX += this.menuWidth;
  505.          if(_root.itemToCreate == _root.upperMenuCount + 1)
  506.          {
  507.             _root.itemXNew = 0;
  508.          }
  509.       }
  510.       else
  511.       {
  512.          this.menuWidth = this.getMenuWidth(dp);
  513.          _root.itemToCreate = _root.upperMenuCount + _root.bottomMenuCount + 2;
  514.       }
  515.       _root.itemToCreate = _root.itemToCreate + 1;
  516.       if(dp[i] == "sep")
  517.       {
  518.          if(this.menuType == "Vertical" || hier > 0)
  519.          {
  520.             menu.createEmptyMovieClip("sep_" + i,- (i + 1));
  521.             menu["sep_" + i]._y = (i - numTitleExist) * this.menuItemHeight - this.numSep * (this.menuItemHeight - 8);
  522.             menu["sep_" + i].beginFill(this.upBGColor,100);
  523.             menu["sep_" + i].drawrectangle(0,0,this.menuWidth,8);
  524.             menu["sep_" + i].endFill();
  525.             menu["sep_" + i].lineStyle(0,this.blockLineColor,100);
  526.             menu["sep_" + i].moveTo(5,4);
  527.             menu["sep_" + i].lineTo(this.menuWidth - 5,4);
  528.          }
  529.          this.numSep += 1;
  530.       }
  531.       else if(dp[i][0] != "")
  532.       {
  533.          this.itemInitObj = new Object();
  534.          if(this.menuType == "Vertical" || hier > 0)
  535.          {
  536.             this.itemInitObj._x = 0;
  537.             this.itemInitObj._y = (i - numTitleExist) * this.menuItemHeight - this.numSep * (this.menuItemHeight - 8) - 1;
  538.          }
  539.          else if(this.menuType == "Horizontal" && hier == 0)
  540.          {
  541.             this.itemInitObj._x = _root.itemXNew;
  542.             _root.itemXNew = _root.itemX;
  543.             this.itemInitObj._y = 0;
  544.             this.itemInitObj.firstHoriz = true;
  545.          }
  546.          var disabled = dp[i][5];
  547.          this.itemInitObj.id = i - this.numSep;
  548.          this.itemInitObj.parent = this;
  549.          this.itemInitObj.txtColor = this.upFontColor;
  550.          this.itemInitObj.txtLabel = dp[i][0];
  551.          this.itemInitObj.txtIsBold = false;
  552.          this.itemInitObj.bgColor = this.upBGColor;
  553.          this.itemInitObj.txtAlign = "left";
  554.          this.itemInitObj.menuWidth = this.menuWidth;
  555.          this.itemInitObj.hasSubs = dp[i][1];
  556.          this.itemInitObj.actionToLoad = dp[i][2];
  557.          this.itemInitObj.alternativeCaption = dp[i][3];
  558.          this.itemInitObj.isCheckBox = dp[i][3];
  559.          this.itemInitObj.checkBoxIsActive = dp[i][4];
  560.          this.itemInitObj.disabled = disabled;
  561.          var zid = i - this.getNumSeps(dp,i - 1) - 1;
  562.          if(applyRadio)
  563.          {
  564.             var f = 0;
  565.             while(f < radioSpecs.length)
  566.             {
  567.                if(zid >= parseInt(radioSpecs[f].start_idx) && zid <= parseInt(radioSpecs[f].end_idx))
  568.                {
  569.                   this.itemInitObj.active = false;
  570.                   if(zid == radioSpecs[f].active)
  571.                   {
  572.                      this.itemInitObj.active = true;
  573.                   }
  574.                   this.itemInitObj.radioGroup = radioSpecs[f].groupName;
  575.                }
  576.                f++;
  577.             }
  578.          }
  579.          menu.attachMovie("ItemSymbol","PItem_" + i,i + 1,this.itemInitObj);
  580.          menu["PItem_" + i].onRollOver = function()
  581.          {
  582.             if(_level1._root.menuVisible)
  583.             {
  584.                var f = 0;
  585.                while(f < this.parent.highlightedItems.length)
  586.                {
  587.                   this.parent.highlightedItems[f].setBackgroundColor(this.parent.upBGColor);
  588.                   this.parent.highlightedItems[f].setTextColor(this.parent.upFontColor);
  589.                   this.parent.highlightedItems[f].update();
  590.                   f++;
  591.                }
  592.                this.parent.highlightedItems.splice(0,this.parent.highlightedItems.length);
  593.                var d = 0;
  594.                while(d < this._parent.treePos)
  595.                {
  596.                   var mc = this.parent["menu_" + d]["PItem_" + this.parent["menu_" + (d + 1)].pID];
  597.                   mc.setBackgroundColor(this.parent.overBGColor);
  598.                   mc.setTextColor(this.parent.overFontColor);
  599.                   mc.update();
  600.                   this.parent.highlightedItems.push(mc);
  601.                   d++;
  602.                }
  603.                if(this.parent.applySound)
  604.                {
  605.                   this.parent.rollOverSndObj.start();
  606.                }
  607.                if(this.parent.collapseTimeBool)
  608.                {
  609.                   clearTimeout(this.parent.tID);
  610.                }
  611.                this.setBackgroundColor(this.parent.overBGColor);
  612.                if(!this.disabled)
  613.                {
  614.                   this.setTextColor(this.parent.overFontColor);
  615.                }
  616.                var inc = 0;
  617.                var temp_depth = this.parent.depth;
  618.                if(this.hasSubs && this._parent.treePos == classRef.family.length || this._parent.treePos == 0)
  619.                {
  620.                   temp_depth += 1;
  621.                }
  622.                if(temp_depth > this._parent.treePos)
  623.                {
  624.                   var k = this._parent.treePos + 1;
  625.                   while(k <= temp_depth)
  626.                   {
  627.                      if(!(this._parent.treePos == 0 && this.parent.depth == 0))
  628.                      {
  629.                         if(this.parent["menu_" + (this._parent.treePos + 1)].parentItemRef._name != this._name)
  630.                         {
  631.                            if(this.parent["menu_" + k] != undefined)
  632.                            {
  633.                               if(this.parent.menuFade)
  634.                               {
  635.                                  this.parent["menu_" + k].onEnterFrame = function()
  636.                                  {
  637.                                     this._alpha -= this._parent.fadeRate;
  638.                                     if(this._alpha < 0)
  639.                                     {
  640.                                        this.removeMovieClip();
  641.                                     }
  642.                                  };
  643.                               }
  644.                               else
  645.                               {
  646.                                  this.parent["menu_" + k].removeMovieClip();
  647.                               }
  648.                               inc++;
  649.                            }
  650.                         }
  651.                      }
  652.                      k++;
  653.                   }
  654.                }
  655.                this.parent.depth -= inc;
  656.                this.parent.family.splice(this.parent.depth,this.parent.family.length);
  657.                if(!this.disabled)
  658.                {
  659.                   if(this._parent.treePos > 0 || this.parent.menuShowChild == "onRollOver" || this.parent.menuShowChild == "onPress" && this.parent.isOnClick)
  660.                   {
  661.                      if(this.parent["menu_" + (this._parent.treePos + 1)].parentItemRef._name != this._name)
  662.                      {
  663.                         if(this.hasSubs)
  664.                         {
  665.                            arrayProvider = "dp";
  666.                            nexthier = this._parent.treePos + 1;
  667.                            this.parent.family.push(this.id - 1);
  668.                            var lv = 0;
  669.                            while(lv < this.parent.family.length)
  670.                            {
  671.                               arrayProvider += "_" + this.parent.family[lv];
  672.                               lv++;
  673.                            }
  674.                            if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
  675.                            {
  676.                               var ox = this._parent._x;
  677.                               var oy = this._parent._y;
  678.                               var nextMenuX = this._parent._x + this._width + this.parent.menuXSpace;
  679.                               var nextMenuY = this._parent._y + this._y - Number(this.parent[arrayProvider][0] != "") * this.parent.menuItemHeight + this.parent.menuYSpace;
  680.                            }
  681.                            else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
  682.                            {
  683.                               var ox = this._parent._x + this._x;
  684.                               var oy = this._parent._y;
  685.                               var nextMenuX = this._parent._x + this._x + this.parent.menuXSpace;
  686.                               var nextMenuY = this._parent._y + this.parent.menuItemHeight + this.parent.menuYSpace;
  687.                            }
  688.                            var nextMenuWidth = this.parent.getMenuWidth(this.parent[arrayProvider]);
  689.                            if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
  690.                            {
  691.                               var lastNextMenuX = this.parent._x + this._parent._x + this._width + this._x + nextMenuWidth;
  692.                            }
  693.                            else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
  694.                            {
  695.                               var lastNextMenuX = this.parent._x + this._parent._x + this._x + nextMenuWidth;
  696.                            }
  697.                            if(lastNextMenuX > this.parent.limitX)
  698.                            {
  699.                               var DX = lastNextMenuX - this.parent.limitX;
  700.                               if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
  701.                               {
  702.                                  nextMenuX = this._parent._x - this.parent.getMenuWidth(this.parent[arrayProvider]);
  703.                                  ox = this.parent._x + this._parent._x;
  704.                               }
  705.                               else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
  706.                               {
  707.                                  nextMenuX -= DX;
  708.                                  ox -= DX;
  709.                               }
  710.                            }
  711.                            var nextMenuHeight = this.parent.menuItemHeight * (this.parent[arrayProvider].length - Number(this.parent[arrayProvider][0] == "")) - this.parent.getNumSeps(this.parent[arrayProvider],this.parent[arrayProvider].length - 1) * (this.parent.menuItemHeight - 8);
  712.                            if(this.parent._y + this._parent._y + this._y + nextMenuHeight + this.parent.menuItemHeight > this.parent.limitY)
  713.                            {
  714.                               nextMenuY = this._parent._y + this._y - nextMenuHeight + this.parent.menuItemHeight;
  715.                               oy = nextMenuY;
  716.                               if(this._parent.treePos == 0 && this.parent.menuType == "Horizontal")
  717.                               {
  718.                                  nextMenuY -= this.parent.menuItemHeight;
  719.                               }
  720.                            }
  721.                            this.parent.createMenu(nextMenuX,nextMenuY,nexthier,this.parent[arrayProvider],arrayProvider,ox,oy);
  722.                         }
  723.                      }
  724.                   }
  725.                }
  726.                this.parent.isOnSub = true;
  727.                this.update();
  728.             }
  729.          };
  730.          menu["PItem_" + i].onRollOut = function()
  731.          {
  732.             this.parent.isOnSub = false;
  733.             this.setBackgroundColor(this.parent.upBGColor);
  734.             if(!this.disabled)
  735.             {
  736.                this.setTextColor(this.parent.upFontColor);
  737.             }
  738.             this.update();
  739.             if(this.parent.collapseTimeBool)
  740.             {
  741.                this.parent.tID = setTimeout(this.parent,"collapseAll",this.parent.collapseTime,[]);
  742.             }
  743.          };
  744.          menu["PItem_" + i].onPress = function()
  745.          {
  746.             if(_level1._root.menuVisible and (!_level1._root.translating and !_level1._root.switchingStage))
  747.             {
  748.                this.setBackgroundColor(this.parent.downBGColor);
  749.                if(!this.disabled)
  750.                {
  751.                   this.setTextColor(this.parent.downFontColor);
  752.                }
  753.                this.update();
  754.                if(!this.disabled)
  755.                {
  756.                   if(hier == 0 && this.parent.menuShowChild == "onPress")
  757.                   {
  758.                      if(this.parent.family[0] != this.id - 1)
  759.                      {
  760.                         if(this.hasSubs)
  761.                         {
  762.                            this.parent.isOnClick = true;
  763.                            arrayProvider = "dp";
  764.                            nexthier = hier + 1;
  765.                            this.parent.family.splice(hier,this.parent.family.length);
  766.                            this.parent.family.push(this.id - 1);
  767.                            var lv = 0;
  768.                            while(lv < this.parent.family.length)
  769.                            {
  770.                               arrayProvider += "_" + this.parent.family[lv];
  771.                               lv++;
  772.                            }
  773.                            if(this.parent.menuType == "Vertical" || hier > 0)
  774.                            {
  775.                               var ox = this._parent._x;
  776.                               var oy = this._parent._y;
  777.                               var nextMenuX = this._parent._x + this._width + this.parent.menuXSpace;
  778.                               var nextMenuY = this._parent._y + this._y - Number(this.parent[arrayProvider][0] != "") * this.parent.menuItemHeight + this.parent.menuYSpace;
  779.                            }
  780.                            else if(this.parent.menuType == "Horizontal" && hier == 0)
  781.                            {
  782.                               var ox = this._parent._x + this._x;
  783.                               var oy = this._parent._y;
  784.                               var nextMenuX = this._parent._x + this._x + this.parent.menuXSpace;
  785.                               var nextMenuY = this._parent._y + this.parent.menuItemHeight + this.parent.menuYSpace;
  786.                            }
  787.                            var nextMenuWidth = this.parent.getMenuWidth(this.parent[arrayProvider]);
  788.                            if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
  789.                            {
  790.                               var lastNextMenuX = this.parent._x + this._parent._x + this._width + this._x + nextMenuWidth;
  791.                            }
  792.                            else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
  793.                            {
  794.                               var lastNextMenuX = this.parent._x + this._parent._x + this._x + nextMenuWidth;
  795.                            }
  796.                            if(lastNextMenuX > this.parent.limitX)
  797.                            {
  798.                               var DX = lastNextMenuX - this.parent.limitX;
  799.                               if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
  800.                               {
  801.                                  nextMenuX = this._parent._x - this.parent.getMenuWidth(this.parent[arrayProvider]);
  802.                                  ox = this.parent._x + this._parent._x;
  803.                               }
  804.                               else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
  805.                               {
  806.                                  nextMenuX -= DX;
  807.                                  ox -= DX;
  808.                               }
  809.                            }
  810.                            var nextMenuHeight = this.parent.menuItemHeight * (this.parent[arrayProvider].length - Number(this.parent[arrayProvider][0] == "")) - this.parent.getNumSeps(this.parent[arrayProvider],this.parent[arrayProvider].length - 1) * (this.parent.menuItemHeight - 8);
  811.                            if(this.parent._y + this._parent._y + this._y + nextMenuHeight + this.parent.menuItemHeight > this.parent.limitY)
  812.                            {
  813.                               nextMenuY = this._parent._y + this._y - nextMenuHeight + this.parent.menuItemHeight;
  814.                               oy = nextMenuY;
  815.                               if(this._parent.treePos == 0 && this.parent.menuType == "Horizontal")
  816.                               {
  817.                                  nextMenuY -= this.parent.menuItemHeight;
  818.                               }
  819.                            }
  820.                            this.parent.createMenu(nextMenuX,nextMenuY,nexthier,this.parent[arrayProvider],arrayProvider,ox,oy);
  821.                         }
  822.                      }
  823.                   }
  824.                }
  825.                if(this.parent.applySound)
  826.                {
  827.                   this.parent.pressSndObj.start();
  828.                }
  829.                this.parent.isOnSub = true;
  830.             }
  831.          };
  832.          menu["PItem_" + i].onRelease = function()
  833.          {
  834.             if(_level1._root.menuVisible and (!_level1._root.translating and !_level1._root.switchingStage))
  835.             {
  836.                _root.specificationFromVolume = false;
  837.                this.setBackgroundColor(this.parent.upBGColor);
  838.                if(!this.disabled)
  839.                {
  840.                   this.setTextColor(this.parent.upFontColor);
  841.                }
  842.                this.update();
  843.                this.parent.parentPressedLabel = this._parent.parentLabel;
  844.                this.parent.pressedLabel = this.txtLabel;
  845.                this.parent.pressedIdx = this.id - 1;
  846.                if(this.actionToLoad != "no" and this.actionToLoad != "en" and this.actionToLoad != "de" and this.actionToLoad != "hr")
  847.                {
  848.                   _level1._root.setAlternativeCaption(this.alternativeCaption);
  849.                   _level1._root.setCaption(this.parent.xmlFileName,menu.pID,this.parent.parentPressedLabel,this.parent.pressedLabel,this.actionToLoad);
  850.                }
  851.                if(!this.disabled)
  852.                {
  853.                   _level1._root.controller(this.actionToLoad);
  854.                   if(this.radioGroup != undefined)
  855.                   {
  856.                      var lastChecked = this.parent.getRadioActiveItem(this.radioGroup);
  857.                      this.parent["PItem_" + lastChecked].RadioButton._visible = false;
  858.                      this.RadioButton._visible = true;
  859.                      var count = 0;
  860.                      var y = 0;
  861.                      while(y < this.id)
  862.                      {
  863.                         if(dp[i] == "sep")
  864.                         {
  865.                            count++;
  866.                         }
  867.                         y++;
  868.                      }
  869.                      this.parent.setRadioActiveItem(this.radioGroup,this.id - count - 1);
  870.                   }
  871.                   if(this.isCheckBox)
  872.                   {
  873.                      var idx = this.id + this.parent.getNumSeps(dp,this.id - 1);
  874.                      dp[idx][4] = !this.checkBoxIsActive;
  875.                   }
  876.                }
  877.                this.parent.isOnSub = true;
  878.                if(!this.disabled)
  879.                {
  880.                   eval(this.parent.changeHandler).apply(this.handlerObj);
  881.                }
  882.                if(!this.disabled)
  883.                {
  884.                   if(hier > 0)
  885.                   {
  886.                      this.parent.collapseAll();
  887.                   }
  888.                }
  889.             }
  890.          };
  891.          menu["PItem_" + i].onReleaseOutside = function()
  892.          {
  893.             this.setBackgroundColor(this.parent.upBGColor);
  894.             if(!this.disabled)
  895.             {
  896.                this.setTextColor(this.parent.upFontColor);
  897.             }
  898.             this.update();
  899.             this.parent.isOnSub = false;
  900.             this.parent.collapseAll();
  901.          };
  902.       }
  903.       i++;
  904.    }
  905.    if(this.borderState)
  906.    {
  907.       menu.createEmptyMovieClip("menuBorder",20000);
  908.       menu.menuBorder.lineStyle(this.borderSize,this.borderColor,100);
  909.       if(this.menuType == "Vertical" || hier > 0)
  910.       {
  911.          menu.menuBorder.drawrectangle(0,0,this.menuWidth,this.menuItemHeight * (dp.length - numTitleExist) - this.numSep * (this.menuItemHeight - 8));
  912.       }
  913.       else if(this.menuType == "Horizontal" && hier == 0)
  914.       {
  915.          menu.menuBorder.drawrectangle(0,0,this.menuWidth * (dp.length - 1 - this.numSep),this.menuItemHeight);
  916.       }
  917.    }
  918.    if(this.shadowAppear)
  919.    {
  920.       menu.createEmptyMovieClip("shadow_mc",-20000);
  921.       menu.shadow_mc.beginFill(0,10);
  922.       if(this.menuType == "Vertical" || hier > 0)
  923.       {
  924.          menu.shadow_mc.drawrectangle(this.shadowOffset,this.shadowOffset,this.menuWidth,this.menuItemHeight * (dp.length - numTitleExist) - this.numSep * (this.menuItemHeight - 8));
  925.       }
  926.       else if(this.menuType == "Horizontal" && hier == 0)
  927.       {
  928.          menu.shadow_mc.drawrectangle(this.shadowOffset,this.shadowOffset,this.menuWidth * (dp.length - 1 - this.numSep),this.menuItemHeight);
  929.       }
  930.       menu.shadow_mc.endFill();
  931.    }
  932.    if(this.menuFade)
  933.    {
  934.       menu.onEnterFrame = function()
  935.       {
  936.          this._alpha += this._parent.fadeRate;
  937.          if(this._alpha > 100)
  938.          {
  939.             delete this.onEnterFrame;
  940.          }
  941.       };
  942.    }
  943.    if(this.menuSlide && hier > 0)
  944.    {
  945.       this.$tmpMaskMC.clear();
  946.       this.$tmpMaskMC.beginFill(0,0);
  947.       if(this.menuType == "Vertical" || hier > 0)
  948.       {
  949.          this.$tmpMaskMC.drawrectangle(x,y,this.shadowOffset + this.menuWidth,this.shadowOffset + (this.menuItemHeight * (dp.length - numTitleExist) - this.numSep * (this.menuItemHeight - 8)));
  950.       }
  951.       else if(this.menuType == "Horizontal" && hier == 0)
  952.       {
  953.          this.$tmpMaskMC.drawrectangle(x,y,this.shadowOffset + this.menuWidth * (dp.length - 1 - this.numSep),this.shadowOffset + this.menuItemHeight);
  954.       }
  955.       this.$tmpMaskMC.endFill();
  956.       menu.setMask(this.$tmpMaskMC);
  957.       var slideCurrentTime = 0;
  958.       if(this.menuType == "Vertical" || hier > 1)
  959.       {
  960.          this.onEnterFrame = function()
  961.          {
  962.             if(slideCurrentTime <= this.menuSlideTime)
  963.             {
  964.                menu._x = Math.linearTween(slideCurrentTime,ox,x - ox,this.menuSlideTime);
  965.                slideCurrentTime++;
  966.             }
  967.             else
  968.             {
  969.                delete this.onEnterFrame;
  970.             }
  971.          };
  972.       }
  973.       else if(this.menuType == "Horizontal" && hier == 1)
  974.       {
  975.          this.onEnterFrame = function()
  976.          {
  977.             if(slideCurrentTime <= this.menuSlideTime)
  978.             {
  979.                menu._y = Math.linearTween(slideCurrentTime,oy,y - oy,this.menuSlideTime);
  980.                slideCurrentTime++;
  981.             }
  982.             else
  983.             {
  984.                delete this.onEnterFrame;
  985.             }
  986.          };
  987.       }
  988.    }
  989. };
  990. HFHierMenuClass.prototype.getPressedLabel = function()
  991. {
  992.    return this.pressedLabel;
  993. };
  994. HFHierMenuClass.prototype.getPressedIdx = function()
  995. {
  996.    return this.pressedIdx;
  997. };
  998. HFHierMenuClass.prototype.setChangeHandler = function(ch, obj)
  999. {
  1000.    this.handlerObj = arguments.length >= 2 ? obj : this._parent;
  1001.    this.changeHandler = ch;
  1002. };
  1003. HFHierMenuClass.prototype.collapseAll = function()
  1004. {
  1005.    this.isOnClick = false;
  1006.    this.$tmpMaskMC.clear();
  1007.    var i = 1;
  1008.    while(i <= this.depth)
  1009.    {
  1010.       if(this.menuFade)
  1011.       {
  1012.          this["menu_" + i].onEnterFrame = function()
  1013.          {
  1014.             this._alpha -= this._parent.fadeRate;
  1015.             if(this._alpha < 0)
  1016.             {
  1017.                this.removeMovieClip();
  1018.             }
  1019.          };
  1020.       }
  1021.       else
  1022.       {
  1023.          this["menu_" + i].removeMovieClip();
  1024.       }
  1025.       this.family.splice(0,this.family.length);
  1026.       i++;
  1027.    }
  1028.    var i = 0;
  1029.    while(i < this.highlightedItems.length)
  1030.    {
  1031.       this.highlightedItems[i].setBackgroundColor(this.upBGColor);
  1032.       this.highlightedItems[i].setTextColor(this.upFontColor);
  1033.       this.highlightedItems[i].update();
  1034.       i++;
  1035.    }
  1036.    this.highlightedItems.splice(0,this.highlightedItems.length);
  1037.    this.depth = 0;
  1038. };
  1039. HFHierMenuClass.prototype.getRadioActiveItem = function(cgn)
  1040. {
  1041.    var i = 0;
  1042.    while(i < this.radioGroups.length)
  1043.    {
  1044.       if(this.radioGroups[i].groupName == cgn)
  1045.       {
  1046.          return this.radioGroups[i].active;
  1047.       }
  1048.       i++;
  1049.    }
  1050. };
  1051. HFHierMenuClass.prototype.getRadioItemLabel = function(cgn)
  1052. {
  1053.    var i = 0;
  1054.    while(i < this.radioGroups.length)
  1055.    {
  1056.       if(this.radioGroups[i].groupName == cgn)
  1057.       {
  1058.          var dp_name = this.radioGroups[i].dp_name;
  1059.          var dp = this[dp_name];
  1060.          var id = parseInt(this.radioGroups[i].active);
  1061.          var count = 0;
  1062.          var y = 0;
  1063.          while(y < this.id)
  1064.          {
  1065.             if(dp[i] == "sep")
  1066.             {
  1067.                count++;
  1068.             }
  1069.             y++;
  1070.          }
  1071.          var idx = id + 1 + this.getNumSeps(dp,id + count);
  1072.          var label = dp[idx][0];
  1073.          return label;
  1074.       }
  1075.       i++;
  1076.    }
  1077. };
  1078. HFHierMenuClass.prototype.setRadioActiveItem = function(cgn, id)
  1079. {
  1080.    var i = 0;
  1081.    while(i < this.radioGroups.length)
  1082.    {
  1083.       if(this.radioGroups[i].groupName == cgn)
  1084.       {
  1085.          this.radioGroups[i].active = id;
  1086.          break;
  1087.       }
  1088.       i++;
  1089.    }
  1090. };
  1091. HFHierMenuClass.prototype.getCheckBoxState = function(str, id)
  1092. {
  1093.    var dp = this["dp_" + str];
  1094.    var idx = id + this.getNumSeps(dp,id - 1);
  1095.    return dp[idx][4];
  1096. };
  1097. HFHierMenuClass.prototype.setCheckBoxState = function(str, id, bool)
  1098. {
  1099.    var dp = this["dp_" + str];
  1100.    var idx = id + this.getNumSeps(dp,id - 1);
  1101.    dp[idx][4] = bool;
  1102. };
  1103. HFHierMenuClass.prototype.setEnabled = function(str, id, bool)
  1104. {
  1105.    var dp = this["dp_" + str];
  1106.    var idx = id + this.getNumSeps(dp,id - 1);
  1107.    dp[idx][5] = !bool;
  1108. };
  1109. HFHierMenuClass.prototype.onMouseDown = function()
  1110. {
  1111.    if(!this.isOnSub)
  1112.    {
  1113.       this.collapseAll();
  1114.    }
  1115. };
  1116. HFHierMenuClass.prototype.getParentPressedLabel = function()
  1117. {
  1118.    return this.parentPressedLabel;
  1119. };
  1120. HFHierMenuClass.prototype.getArrayName = function(fam)
  1121. {
  1122.    var arr_name = "dp";
  1123.    var i = 0;
  1124.    while(i < fam.length)
  1125.    {
  1126.       arr_name += "_" + fam[i];
  1127.       i++;
  1128.    }
  1129.    return arr_name;
  1130. };
  1131. HFHierMenuClass.prototype.getNumSeps = function(arr, n)
  1132. {
  1133.    var counter = 0;
  1134.    var i = 1;
  1135.    while(i < arr.length)
  1136.    {
  1137.       if(arr[i] == "sep")
  1138.       {
  1139.          counter++;
  1140.       }
  1141.       if(i - counter - 1 == n)
  1142.       {
  1143.          break;
  1144.       }
  1145.       i++;
  1146.    }
  1147.    return counter;
  1148. };
  1149. HFHierMenuClass.prototype.getMenuWidth = function(dp)
  1150. {
  1151.    var len;
  1152.    var menuWidth = -1;
  1153.    var i = 0;
  1154.    while(i < dp.length)
  1155.    {
  1156.       if(i == 0)
  1157.       {
  1158.          len = dp[0].length;
  1159.       }
  1160.       else
  1161.       {
  1162.          len = dp[i][0].length;
  1163.       }
  1164.       d = dp[i][0].split("I");
  1165.       iCount = d.length - 1;
  1166.       ds = dp[i][0].split(" ");
  1167.       spaceCount = ds.length - 1;
  1168.       dt = dp[i][0].split(".");
  1169.       pointCount = dt.length - 1;
  1170.       realLength = len * this.txtSize - iCount * (this.txtSize - 3) - spaceCount * (this.txtSize - 3) - pointCount * (this.txtSize - 5);
  1171.       if(realLength > menuWidth)
  1172.       {
  1173.          menuWidth = realLength;
  1174.       }
  1175.       i++;
  1176.    }
  1177.    menuWidth += 22;
  1178.    return menuWidth;
  1179. };
  1180. HFHierMenuClass.prototype.getOneMenuWidth = function(dp)
  1181. {
  1182.    var len;
  1183.    var menuWidth = -1;
  1184.    len = dp.length;
  1185.    d = dp.split("I");
  1186.    iCount = d.length - 1;
  1187.    ds = dp.split(" ");
  1188.    spaceCount = ds.length - 1;
  1189.    dt = dp.split(".");
  1190.    pointCount = dt.length - 1;
  1191.    menuWidth = len * this.txtSize - iCount * (this.txtSize - 3) - spaceCount * (this.txtSize - 3) - pointCount * (this.txtSize - 1);
  1192.    menuWidth += 22;
  1193.    return menuWidth;
  1194. };
  1195. Object.registerClass("HFHierMenuSymbol",HFHierMenuClass);
  1196.